;;; -*- Mode: Lisp; Package: STELLA; Syntax: COMMON-LISP; Base: 10 -*-

(CL:IN-PACKAGE "STELLA")

(IN-MODULE "/PL-KERNEL-KB/PL-FOUNDATION/PL-SYSTEM")

(IN-DIALECT :KIF)

(set-feature iterative-deepening)

(DEFRELATION REL_1 ((?a Concept) (?p1 Concept)))
(DEFRELATION REL_2 ((?a Concept) (?p1 Concept) (?p2 Concept)))
(DEFRELATION REL_3 ((?a Concept) (?p1 Concept) (?p2 Concept) (?p3 Concept)))

(DEFCONCEPT R)
(DEFCONCEPT C)
(DEFCONCEPT S)
(DEFCONCEPT Z)

(DEFCONCEPT Adam)      (ASSERT (R Adam))
(DEFCONCEPT Jan)       (ASSERT (R Jan))
(DEFCONCEPT Tomasz)    (ASSERT (R Tomasz))
(DEFCONCEPT Ewa)       (ASSERT (R Ewa))
(DEFCONCEPT Anna)      (ASSERT (R Anna))
(DEFCONCEPT Iza)       (ASSERT (R Iza))
(DEFCONCEPT Warszawa)  (ASSERT (R Warszawa))
(DEFCONCEPT Mediolan)  (ASSERT (R Mediolan))
(DEFCONCEPT Londyn)    (ASSERT (R Londyn))
(DEFCONCEPT oczy)      (ASSERT (R oczy))
(DEFCONCEPT usta)      (ASSERT (R usta))
(DEFCONCEPT wlosy)     (ASSERT (R wlosy))


(DEFCONCEPT piekne)    (ASSERT (C piekne))
(DEFCONCEPT duze)      (ASSERT (C duze))
(DEFCONCEPT jasne)     (ASSERT (C jasne))
(DEFCONCEPT wysoki)    (ASSERT (C wysoki))
(DEFCONCEPT silny)     (ASSERT (C silny))
(DEFCONCEPT szczuply)  (ASSERT (C szczuply))

(DEFCONCEPT spi)       (ASSERT (S spi))
(DEFCONCEPT lubi)      (ASSERT (S lubi))
(DEFCONCEPT leci)      (ASSERT (S leci))

(DEFCONCEPT pieknosc)  (ASSERT (S pieknosc))
(DEFCONCEPT wysport)   (ASSERT (S wysport))
(DEFCONCEPT para)      (ASSERT (S para))
(DEFCONCEPT zna)       (ASSERT (S zna))

(DEFCONCEPT mezczyzni) (ASSERT (Z mezczyzni))
(DEFCONCEPT kobiety)   (ASSERT (Z kobiety))
(DEFCONCEPT sportowcy) (ASSERT (Z sportowcy))
(DEFCONCEPT pary)      (ASSERT (Z pary))

(ASSERT ( AND
		
		(REL_1 spi Adam)
		(REL_1 spi Jan)
		
		(REL_2 lubi Adam Ewa) (REL_2 lubi Ewa Adam)
		(REL_2 lubi Jan Anna) (REL_2 lubi Anna Jan) (REL_2 lubi Anna Tomasz)
		(REL_2 lubi Tomasz Iza) (REL_2 lubi Iza Adam)
		(REL_2 lubi Anna Iza) (REL_2 lubi Iza Anna)
		(REL_2 lubi Anna Ewa)
		
		(REL_3 leci Adam Warszawa Londyn)
		(REL_3 leci Ewa Mediolan Warszawa)
		(REL_3 leci Iza Londyn Mediolan)
		
		(REL_2 piekne oczy Anna) (REL_2 jasne oczy Anna) (REL_2 duze oczy Anna)
		(REL_2 piekne usta Anna) (REL_2 duze oczy Anna)
		(REL_2 piekne wlosy Anna) (REL_2 jasne oczy Anna)
		(REL_2 jasne oczy Ewa)
		(REL_2 piekne usta Ewa)
		(REL_2 jasne oczy Iza) (REL_2 duze oczy Iza)
		(REL_2 jasne wlosy Iza)
		
		(REL_1 wysoki Adam) (REL_1 silny Adam)
		(REL_1 szczuply Jan) (REL_1 silny Jan)
		(REL_1 szczuply Tomasz)
		
))

(ASSERT (
	FORALL (?x ?y) (
		<=>
			(REL_2 zna ?x ?y)
			(EXISTS (?z S) (
				REL_2 ?z ?x ?y
			))
			
	)
))

(ASSERT (
	FORALL ((?x R) (?y R)) (
		<=>
			(AND (REL_2 para ?x ?y) (REL_2 para ?y ?x))
			(AND (REL_2 lubi ?x ?y) (REL_2 lubi ?y ?x))
	)
))

(ASSERT (
	FORALL ((?x R)) (
		=>
			(AND (REL_2 duze oczy ?x) (REL_2 jasne oczy ?x))
			(REL_2 piekne oczy ?x)
	)
))

(ASSERT (
	FORALL ((?x R)) (
		<=>
			(REL_1 pieknosc ?x)
			(EXISTS ((?y R)(?z R)) (
				REL_2 piekne ?y ?x
			))
	)
))

(ASSERT (
	FORALL ((?x R)) (
		<=>
			(REL_1 wysport ?x)
			(OR 
					(AND (REL_1 silny ?x) (REL_1 wysoki ?x))
					(AND (REL_1 silny ?x) (REL_1 szczuply ?x))
			)
	)
))


